Welcome to Creating a Web Server with Node.js. After watching this video, you will be able
to: Describe the characteristics of Node.js and
write a simple web server with Node.js. Node.js is a server-side programming framework
that uses JavaScript as its programming language. Many developers are already familiar with
the JavaScript language. It is built with a heavy emphasis on
concurrent programming with a lightweight language. Node.js is a single-threaded application environment
that handles input/output (I/O) operations through events. Instead of blocking on asynchronous I/O operations,
you write callback functions to handle results when they complete. Node.js is suited for developers who want
to build scalable and concurrent server applications by using features like callback functions and
the Node.JS runtime event loop. These features of the JavaScript language
and the Node.js runtime enable quick development with a minimal set of tools. Every JavaScript file is a module in Node.js.
A module corresponds to a script file. A package can contain one or more nodes. The Node.js runtime is packaged with many
utility modules that you can use to create and extend your applications. With the HTTP Node.js module, you can develop
an application that listens to HTTP requests and returns HTTP response messages. To create an instance of a web server, use
the HTTP.createServer function. The web server is stored in a variable called
"server." The createServer function takes in an optional
callback function as a parameter. This callback function handles the incoming
request message and provides an appropriate response message. The callback function shown here is anonymous. After you create an instance of the server
object, you can set the server to listen to a specific port; for example, call the HTTP.listen function
with a parameter of 8080 as the port to set the server to listen on 8080. In this video, you learned that: Node.js is a single-threaded application environment
that handles I/O operations through events. Every JavaScript file is a module in Node.js. With the HTTP Node.js module, you can develop
an application that listens to HTTP requests and returns HTTP response messages.